<%@page import="util.CountHelper"%>
<%@page import="data.Succursale"%>
<%@page import="java.util.ArrayList"%>
<%@page import="messages.SystemMessage"%>
<%@page import="controlleur.succursaleControlleur"%>
<%
 // recuperer la liste de succursale
	succursaleControlleur sc = new succursaleControlleur();
	ArrayList<Succursale> succursales = sc.getSuccursaleFromDetaillant(Integer.parseInt(session.getAttribute(SystemMessage.DETAILLANT_ID).toString()));
	String str = "";
	
	
	// construction de la liste
	for(Succursale s: succursales)
	{
		int nbProm = CountHelper.countPromFromSucc(s.getId());
		str += "<li><a href=\"viewSuccursale.jsp?"+SystemMessage.SUCCURSALE_ID+"="+s.getId()+"\" data-transition=\"slide\">"+s.getNom()+"</a><span class=\"ui-li-count\">"+nbProm+"</span><a href=\"editSuccursale.jsp?"+SystemMessage.SUCCURSALE_ID+"="+s.getId()+"\"></a></li>";
	}
		
	
%>
 <jsp:include page="../part/header.jsp" />		
 		
 		<div data-role="header" >
            <h1>Succursales</h1>
             <a href="addSuccursale.jsp?<%=SystemMessage.SUCCURSALE_ID %>=-1" data-icon="plus" class="ui-btn-right">Ajouter</a>
        </div>
 		
 		<div data-role="content">
            <ul data-role="listview" data-inset="true" data-dividertheme="a" data-filter="true" data-split-theme="c" data-split-icon="gear">
            	
            	
            	<%=str %>
            	
            </ul>  
            

        </div>
        
 <jsp:include page="../part/footer.jsp" />	